package com.guijq.design.factory.pizzafactory;

import com.guijq.design.factory.pizzafactory.pizza.CheesePizza;
import com.guijq.design.factory.pizzafactory.pizza.ClamPizza;
import com.guijq.design.factory.pizzafactory.pizza.PepperoniPizza;
import com.guijq.design.factory.pizzafactory.pizza.Pizza;
import com.guijq.design.factory.pizzafactory.pizza.VeggiePizza;

/**
 * Created by Gavin on 2017/3/9.
 */
public class SimplePizzaFactory {
    public Pizza createPizza(String type) {
        Pizza pizza = null;

        if (type.equals("cheese")) {
            pizza = new CheesePizza();
        } else if (type.equals("pepperoni")) {
            pizza = new PepperoniPizza();
        } else if (type.equals("clam")) {
            pizza = new ClamPizza();
        } else if (type.equals("veggie")) {
            pizza = new VeggiePizza();
        }

        return pizza;
    }
}
